package com.levi.controller.product;

import com.levi.fallback.ProductFallbackFactory;
import com.levi.pojo.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/product")
@FeignClient(value = "service-product",fallbackFactory = ProductFallbackFactory.class)
public interface ProductControllerApi {

    @GetMapping("save")
    Boolean save(@RequestParam String name,@RequestParam Integer stock);

    @GetMapping("decutProduct")
    String decutProduct(@RequestParam Integer id,
                         @RequestParam Integer count);

    @GetMapping("getProductById")
    Product getProductById(Integer id);

    /**
     * 测试nacos-config配置中心
     * @return
     */
    @GetMapping("configInfo")
    String configInfo();

    /**
     * 测试 gateway网关
     * @return
     */
    @GetMapping("gateway")
    String gateway();

    @GetMapping("testSentinel")
    String testSentinel();
}
